﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace BizElements.TemplateEngine
{
    /// <summary>Component variable definition/metadata.</summary>
    public sealed class TemplateComponentVariableDefinition
    {
        #region Constructors.

        /// <summary>Initializes a new instance of <b>TemplateVariableInfo</b> class.</summary>
        public TemplateComponentVariableDefinition(string name, string defaultValue, string description)
        {
            this.Name = name;
            this.DefaultValue = defaultValue;
            this.Description = description;
            this.AllowedValues = new NameValuePair[0];
        }

        /// <summary>Initializes a new instance of <b>TemplateVariableInfo</b> class.</summary>
        public TemplateComponentVariableDefinition(string name, string defaultValue, string description, NameValuePair[] allowedValues)
        {
            this.Name = name;
            this.DefaultValue = defaultValue;
            this.Description = description;
            this.AllowedValues = allowedValues ?? new NameValuePair[0];
        }

        #endregion

        #region Properties.

        /// <summary>Gets variable name.</summary>
        public string Name { get; private set; }

        /// <summary>Gets default value.</summary>
        public string DefaultValue { get; private set; }

        /// <summary>Gets variable description.</summary>
        public string Description { get; private set; }

        /// <summary>Gets an optional list of allowed value.</summary>
        public NameValuePair[] AllowedValues { get; private set; }

        #endregion

        /// <summary>Expression that determines whether the variable is applicable to an input component.</summary>
        internal string UsedForBooleanExpression { get; set; }
    }
}
